package config

import "github.com/spf13/viper"

type ViperData struct {
	Mysql struct {
		User string
		Pass string
		Host string
		Port int
		Data string
	}
	Redis struct {
		Addr string
		Pass string
		DB   int
	}
}

type Nacos struct {
	NamespaceId string
	IpAddr      string
	Port        uint64
	DataId      string
	Group       string
}

var NacosConf Nacos

func GetViperData() {
	viper.SetConfigFile("./basic/config/config.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic("配置文件读取失败")
	}
	err = viper.Unmarshal(&NacosConf)
	if err != nil {
		panic("配置文件解析失败")
	}
}
